/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package iteracon.generator.iterator;

import java.util.Iterator;
import java.util.ListIterator;

/**
 *
 * @author martin
 */
public class FromZeroToListIter implements ListIterator<Integer>{
    private final int _size;
    private int _index;
    
    public FromZeroToListIter(int size, int index){
      _size=size;
      _index=index;
    }
    
    @Override
    public boolean hasNext() {
      return _index<_size;
    }

    @Override
    public Integer next() {
      return _index++;
    }

    @Override
    public void remove() {
      throw new UnsupportedOperationException("Immutable");
    }

  @Override
  public boolean hasPrevious() {
      return _index>0;
  }

  @Override
  public Integer previous() {
    return _index++;
  }

  @Override
  public int nextIndex() {
    return _index+1;
  }

  @Override
  public int previousIndex() {
    return _index-1;
  }

  @Override
  public void set(Integer e) {
      throw new UnsupportedOperationException("Immutable");
  }

  @Override
  public void add(Integer e) {
      throw new UnsupportedOperationException("Immutable");
  }
    
}